<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
        <h1>test</h1>
	</body>
    <script type="text/javascript">
        function sum(){
            let arr = Array.prototype.slice.call(arguments);
            let num = as(arr,0);
            function add(){
                let addArr = Array.prototype.slice.call(arguments);
                num = as(addArr,num);
                return add;
            }
            
            add.toString = function(){
                return num;
            }

            return add;
        }

        function as(arr,initNum){
            let s;
            return arr.reduce((pre,next)=>{
                s=pre+next;
                return s
            },initNum)
        }
        
        console.log(sum(1,2,3)(1,2)(3,4))
	</script>
</html>
